<template>
    <van-grid :border="false" :column-num="2">
        <van-grid-item v-for="(v, i) in list" :key="i" @click="swthFun(v.goods_id)">
            <van-image :src="v.goods_small_logo ? v.goods_small_logo :
                'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg'" style="width: 100%;" />
            <span>{{ v.goods_name }}</span>
        </van-grid-item>
    </van-grid>
</template>

<script setup>
import { ref } from 'vue'
import { searchApi } from '@/api/api';

let list = ref({})
const search = () => {
    searchApi().then(res => {
        list.value = res.data.message.goods
    })
}
search()


import { useRoute, useRouter } from 'vue-router'

const router = useRouter()
const route = useRoute()
const swthFun = () => {
    router.push({ path: "/list", query: { goods_id: 'goods_id' } })
}
</script>

<style lang="scss" scoped></style>